home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PORTABLE.ZIP / SAVETTY.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  57 lines

  1. #ifndef NO_MEMORY_H
  2. #include <memory.h>
  3. #endif
  4. #define        CURSES_LIBRARY  1
  5. #include <curses.h>
  6. #undef savetty
  7.  
  8. #ifndef NDEBUG
  9. char *rcsid_savetty = "$Header: c:/curses/portable/RCS/savetty.c%v 2.0 1992/11/15 03:29:13 MH Rel $";
  10. #endif
  11.  
  12.  
  13.  
  14.  
  15. /*man-start*********************************************************************
  16.  
  17.   savetty()    - save/restore terminal modes
  18.  
  19.   X/Open Description:
  20.        These routines save and restore the state of the terminal modes.
  21.        The savetty() function saves the current state in a buffer and
  22.        resetty() restores the state to what it was at the last call to
  23.        savetty().
  24.  
  25.   PDCurses Description:
  26.        FYI: It is very unclear whether this is a duplication of the
  27.        reset_prog_mode() and reset_shell_mode() functions or whether
  28.        this is a backing store type of operation.  At this time, they
  29.        are implemented similar to the reset_*_mode() routines.
  30.  
  31.   X/Open Return Value:
  32.        The savetty() function returns OK upon success otherwise ERR is
  33.        returned.
  34.  
  35.   Portability:
  36.        PDCurses        int savetty( void );
  37.        X/Open Dec '88  int savetty( void );
  38.        SysV Curses     int savetty( void );
  39.        BSD Curses      int savetty( void );
  40.  
  41. **man-end**********************************************************************/
  42.  
  43. int    savetty(void)
  44. {
  45.        c_save_tty.been_set = TRUE;
  46. #if    defined(DOS) || defined(OS2)
  47. #  if  SMALL || MEDIUM
  48.        movedata( FP_SEG(&_cursvar),            FP_OFF(&_cursvar),
  49.                  FP_SEG(&c_save_tty.saved),    FP_OFF(&c_save_tty.saved),
  50.                  sizeof(SCREEN) );
  51. #  else
  52.        memcpy(&c_save_tty.saved, &_cursvar, sizeof(SCREEN));
  53. #  endif
  54. #endif
  55.        return( OK );
  56. }
  57.